#include "queue.h"


void PriorityQueue::insert(Edge newEdge)
{
	s->insert(newEdge);
}
 
Edge PriorityQueue::deleteMin()
{
	return s->deleteMin();
}

void PriorityQueue::setStrategy(QueueStrategy *s)
{
	this->s = s;
}












// I know this switch stuff looks bad (it is), you'll want to find a way to do this
// properly in assignment 2 ;)
PriorityQueue::PriorityQueue(QueueType type, int size)
	: binaryHeap(0), unorderedArray(0), type(type)
{
	switch (type)
	{
		case heap:
			binaryHeap = new Heap(size);
			break;
			
		case unordered:
			//unorderedArray = new UnorderedArray(size);
			break;
			
		default:
			throw std::runtime_error("Invalid queue type, unable to create");
			break;
	}
}




/*
void PriorityQueue::insert(Edge newEdge)
{
	switch (type)
	{
		case heap:
			binaryHeap->insert(newEdge);
			break;
			
		case unordered:
			unorderedArray->insert(newEdge);
			break;
			
		default:
			throw std::runtime_error("Invalid queue type, unable to insert");
			break;
	}
}
*/
/*
Edge PriorityQueue::deleteMin()
{
	switch (type)
	{
		case heap:
			return binaryHeap->deleteMin();
			break;
			
		case unordered:
			return unorderedArray->deleteMin();
			break;
			
		default:
			throw std::runtime_error("Invalid queue type, unable to delete");
			break;
	}
}
*/
